package com.ptc.ims.client.util;

import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.VerticalPanel;

public class CustomDialogBox 
extends DialogBox
{
	private final VerticalPanel verticalPanel;
	private final FlowPanel contactButtons;
	
	public CustomDialogBox() 
	{
		verticalPanel = new VerticalPanel();
		contactButtons = new FlowPanel();
		contactButtons.addStyleName("buttons");
	}
	
	public CustomDialogBox addButton(String label, ClickHandler handler)
	{
		Button button = new Button(label);
		button.addClickHandler(handler);
		contactButtons.add(button);
		return this;
	}
	
	public CustomDialogBox addMessage(String message)
	{
		verticalPanel.add(new HTML(message));
		return this;
	}
	
	public CustomDialogBox addTitle(String title)
	{
		setText(title);
		return this;
	}
	
	public CustomDialogBox build()
	{
		verticalPanel.add(contactButtons);
		add(verticalPanel);
		center();
		return this;
	}
}